package com.niiwoo.civet.account.service;

import com.niiwoo.civet.account.dto.common.ProjectInvestCancelOrderDTO;
import com.niiwoo.civet.account.dto.common.ProjectInvestCustodyOrderDTO;
import com.niiwoo.civet.account.dto.request.InvestPayDubboRequestDTO;
import com.niiwoo.civet.account.dto.response.CompleteInvestOrderResponseDTO;
import com.niiwoo.civet.account.dto.response.InvestPaymentRedoResponseDTO;
import com.niiwoo.tripod.lanmao.response.LanMaoGatewayDTO;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Set;

/**
 * 账户中心投资服务
 */
public interface AccountInvestDubboService {

    /**
     * 构建投资支付网关参数
     *
     * @param investPayDubboRequestDTO
     * @return
     */
    LanMaoGatewayDTO buildInvestPayGateWayParam(InvestPayDubboRequestDTO investPayDubboRequestDTO);

    /**
     * 投资-调用存管
     *
     * @param investPayDubboRequestDTO
     */
    void accountInvest(InvestPayDubboRequestDTO investPayDubboRequestDTO);

    /**
     * 内部发起存管投资订单处理
     *
     * @param investOrderId
     */
    void accountInvestInternalHandle(Long investOrderId);

    /**
     * 外部发起存管投资订单处理
     *
     * @param requestNo
     * @param code
     * @param status
     * @param errorCode
     * @param errorMessage
     * @return
     */
    Long accountInvestExternalHandle(String requestNo, Byte code, String status, String errorCode, String errorMessage);

    /**
     * 通过投资订单ID列表查询存管投资订单列表
     *
     * @param investOrderIdSet
     * @return
     */
    public List<ProjectInvestCustodyOrderDTO> queryProjectInvestCustodyOrderListByInvestOrderIdSet(
            Set<Long> investOrderIdSet);

    /**
     * 投资订单取消
     *
     * @param projectInvestCancelOrderDTO
     */
    void projectInvestCancel(ProjectInvestCancelOrderDTO projectInvestCancelOrderDTO);

    /**
     * 存在存管投资订单则发起处理完成流程
     *
     * @param accountId     账户id
     * @param investOrderId 投资订单id
     * @return
     */
    default CompleteInvestOrderResponseDTO completeInvestOrderIfExist(@NotNull Long accountId, @NotNull Long investOrderId) {
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 重新支付投资订单。
     * 不存在订单则发起支付，免密或网关
     * 存在则检查订单结果
     *
     * @param accountId     账户id
     * @param investOrderId 投资订单id
     * @return
     */
    default InvestPaymentRedoResponseDTO redoInvestOrderPayment(@NotNull Long accountId, @NotNull InvestPayDubboRequestDTO investRequestDTO) {
        throw new UnsupportedOperationException("unimplemented");
    }
    /**
	 * 智能投订单存管调用
	 * 
	 * @param packageInvestOrderId
	 */
	default void intelligenceInvest(Long packageInvestOrderId) {
		throw new UnsupportedOperationException("unimplemented");
	}

	/**
	 * 智能投订单取消投资调用
	 * 
	 * @param packageInvestOrderId
	 */
	default void intelligenceCancel(Long id) {
		throw new UnsupportedOperationException("unimplemented");
	}
}
